package com.cidp.system.service.impl;

import com.cidp.system.dao.IMenuDao;
import com.cidp.system.model.Tmenu;
import com.cidp.system.service.IMenuService;
import com.litt.core.exception.BusiException;
import com.litt.core.page.IPageList;
import com.litt.core.page.PagePoParam;

/**
 * <b>标题：</b>系统菜单Service实现.
 * <pre><b>描述</b>
 *    系统菜单管理
 * </pre>
 * 
 * @author lijian
 * @since 2008-5-23
 * @version 1.0
 */
public class MenuServiceImpl implements IMenuService {
	
	private IMenuDao menuDao;

	/**
	 * 读取系统菜单信息
	 * @param menuId 系统菜单ID
	 * @return Tmenu对象
	 * @throws BusiException 
	 */
	public Tmenu loadById(Long menuId) throws BusiException{
		if(menuId != null)
			return menuDao.loadById(menuId);
		else
			throw new BusiException("传入参数为空");
	}

	/**
	 * 逻辑删除系统菜单信息.
	 * 
	 * @param menuId 系统菜单ID
	 * @throws BusiException 
	 */
	public void deleteTmenu(Long menuId) throws BusiException{
		if(menuId != null)
			menuDao.deleteTmenu(menuId);
		else
			throw new BusiException("传入参数为空");
	}

	/**
	 * 恢复逻辑删除的系统菜单信息.
	 * 
	 * @param menuId 系统菜单ID
	 * @throws BusiException 
	 */
	public void resumeTmenu(Long menuId) throws BusiException{
		if(menuId != null)
			menuDao.resumeTmenu(menuId);
		else
			throw new BusiException("传入参数为空");
	}
	
	/**
	 * 保存系统菜单信息.
	 * 
	 * @param menu 系统菜单对象
	 * @return 主键
	 * @throws BusiException 
	 */
	public Long saveTmenu(Tmenu menu) throws BusiException{
		if(menu != null)
			return menuDao.saveTmenu(menu);
		else
			throw new BusiException("传入参数为空");
	}

	/**
	 * 更新系统菜单信息.
	 * 
	 * @param menu 系统菜单对象
	 * @throws BusiException 
	 */
	public void updateTmenu(Tmenu menu) throws BusiException{
		if(menu != null)
			menuDao.updateTmenu(menu);
		else
			throw new BusiException("传入参数为空");
	}

	/**
	 * 分页查询系统菜单信息.
	 * 
	 * @param pagePoParam 查询参数
	 * @return IPageList IPageList对象
	 * @throws BusiException 
	 */
	public IPageList listByPage(PagePoParam pagePoParam) throws BusiException {
		if(pagePoParam != null)
			return menuDao.listByPage(pagePoParam);
		else
			throw new BusiException("传入参数为空");
	}
	public void setMenuDao(IMenuDao menuDao) {
		this.menuDao = menuDao;
	}


	
}

